﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OpenCard.aspx.cs" Inherits="WebSite.admin.product.OpenCard" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>上海叶盟实业后台管理系统</title>
    <link href="../main.css" rel="stylesheet" type="text/css" />
    <script language="javascript">
        parent.maintitle.innerHTML = "礼品卡管理";
        parent.contentmain.innerHTML = "<span class='title01'>所在位置：</span>开卡管理"
    </script>
    <script language='javascript'>
        var path = (window.top.location).toString();
        if (path.indexOf('login.aspx') == -1) {
            if (path.indexOf('index.aspx') == -1) {
                window.top.location = 'index.aspx';
            }
        }
	</script>
	<script type="text/javascript" language="javascript">
	    function CheckSelect(del, str) {
	        var rt = true;
	        var num = 0;
	        var boxorder = 0;
	        var objCheckBox;
	        for (var i = 0; i < form1.length; i++) {
	            ///alert(form1.elements[i].type);
	            if (form1.elements[i].type == "checkbox") {
	                boxorder++;
	                objCheckBox = form1.elements[i];
	                ///alert(objCheckBox.checked);
	                if (objCheckBox.checked) {
	                    if (boxorder > 1) {
	                        //如果是第一个CheckBox，是用来全选全消的，这个不算，不用自加
	                        num++;
	                    }
	                }
	            }
	        }
	        ///alert(num);
	        if (!del) {
	            if (num > 1) {
	                alert("此操作不允许选择多个事件");
	                rt = false;
	            }
	        }
	        if (str == 'del') {
	            if (num == 0) {
	                alert("你没有选择要开卡的记录");
	                rt = false
	            } else { return confirm('你确定要对选种的卡片开卡吗?'); }
	            ///alert(rt);
	        }
	        else {
	            if (str == 'update') {
	                if (num == 0) {
	                    alert("你没有选择要更新的信息");
	                    rt = false
	                } else { return confirm('你确定要更新这些信息吗?'); }
	                ///alert(rt);
	            }
	        }
	        return rt;
	    }

	    function SelectAll(sa) {
	        ///全选/全消
	        var objCheckBox;
	        for (var i = 0; i < form1.length; i++) {
	            if (form1.elements[i].type == "checkbox") {
	                objCheckBox = form1.elements[i];
	                objCheckBox.checked = sa;
	            }
	        }
	    }
</script>
    <style type="text/css">
        #ordercode
        {
            width: 143px;
        }
        .style1
        {
            width: 3%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <br />

      <table width="98%" border="0" cellpadding="0" cellspacing="4" bgcolor="#FAFBFC" class="img">
    <tr>
      <td width="4%"><img height="22" alt="SEARCH" src="../images/icon_search.gif" width="26" border="0" /></td>
      <td width="8%" align="right">卡号</td>
      <td width="8%"><input size="12" name="cardcodeFrom" id="cardcodeFrom" 
              runat="server" />&nbsp; </td>
      <td width="2%">至</td>
      <td width="8%"> 
          <input size="12" name="cardcodeTo" id="cardcodeTo" 
              runat="server" /></td>
       <td id="tdCompany" runat="server" align="right" width="10%">经销商</td>
      <td id="tdCompanySelect" runat="server" colspan="3" width="16%">
              <asp:DropDownList ID="ddlCompany0" runat="server">
              </asp:DropDownList>
            </td>
     
      <td>
         <asp:DropDownList ID="ddlProfessionAreaType" runat="server" 
              onselectedindexchanged="ddlProfessionAreaType_SelectedIndexChanged" 
              AutoPostBack="True"></asp:DropDownList>
      </td>
      <td>
       <asp:DropDownList ID="ddlCardType" runat="server">
         <asp:ListItem Text="所属卡片类型"  Value=""></asp:ListItem>
       </asp:DropDownList>
       </td>
       </tr>
       <tr>

          <td width="8%" colspan="2" style="display:none;" align="right">开卡时间</td>
      <td width="8%" align="left" style="display:none;">
           <input name="txtSartTime" type="text" id="txtSartTime" style="behavior:url('../../LWDP2.HTC'); width: 80px;" runat="server" />
      </td>
      <td width="2%" style="display:none;" align="left">
           至</td>
      <td width="8%" style="display:none;" align="left">
        <input name="txtEndTime" type="text" id="txtEndTime" style="behavior:url('../../LWDP2.HTC'); width: 80px;" runat="server" /></td>

         <td width="4%" align="right">状态</td>
      <td width="10%" align="left">
          <asp:DropDownList ID="ddlStates" runat="server">
          <asp:ListItem Text="未激活" Value="4"></asp:ListItem>
          <asp:ListItem Text="已开卡" Value="1"></asp:ListItem>
          <asp:ListItem Text="已使用" Value="2"></asp:ListItem>
          <asp:ListItem Text="已失效" Value="3"></asp:ListItem>
         
          </asp:DropDownList>
      </td>
      <td align="left" colspan="6">
         <asp:ImageButton ID="ibtnSearch" ImageUrl="../images/button04.gif" runat="server" OnClick="ibtnSearch_Click" />
      &nbsp;
       <asp:ImageButton ID="ibtnExport" ImageUrl="../images/btnExport.gif" runat="server" OnClick="ibtnExport_Click" />
      
      &nbsp;

        <asp:ImageButton ID="ibtnStoreOut" ImageUrl="../images/btnGetCard.gif" runat="server" OnClick="ibtnStoreOut_Click" />
&nbsp;
 <asp:ImageButton  ID="btnExport0" ImageUrl="../images/btnExportTemplate.gif" runat="server"  OnClick="ibtnExport0_Click" />

      </td>
   
    </tr>
  </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F1F4F7">
<tr>
<td height="382" align="center" valign="top">
  <br />
  
  <asp:GridView ID="GridView1" runat="server" Width="98%" CellPadding="4" 
        ForeColor="#333333" DataKeyNames="cardid" AutoGenerateColumns="False" 
        AllowPaging="True" pagesize="500" BorderStyle="Solid" BorderWidth="1px" OnRowDataBound="GridView1_RowDataBound"
      ShowFooter="false" EmptyDataText="没有数据记录！！" AllowSorting="True" 
        OnSorting="GridView1_Sorting" onrowcommand="GridView1_RowCommand">
        <Columns>
            <asp:TemplateField ShowHeader="False" HeaderText="选择">
             <ItemStyle Width="30px" Wrap="False" />
             <HeaderTemplate>
                 <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
             </HeaderTemplate>
             <ItemTemplate>
                 <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
             </ItemTemplate>
            </asp:TemplateField>
        <asp:BoundField HeaderText="卡 号" DataField="cardcode" sortexpression="cardcode" />
        <asp:BoundField HeaderText="金 额" DataField="cardPrice" sortexpression="cardPrice" />
          <asp:BoundField HeaderText="礼品卡类别" DataField="CardTypeName" sortexpression="CardTypeName" />
              <asp:BoundField HeaderText="专区开始日期" DataField="starttime" DataFormatString="{0:yyyy-MM-dd}" sortexpression="endtime"  />
        <asp:BoundField HeaderText="专区截止日期" DataField="endtime" DataFormatString="{0:yyyy-MM-dd}" sortexpression="endtime"  />
            <asp:BoundField HeaderText="礼品商城开始日期" DataField="startTimeII" DataFormatString="{0:yyyy-MM-dd}" sortexpression="startTimeII" />
          <asp:BoundField HeaderText="礼品商城截止日期" DataField="lasttime" DataFormatString="{0:yyyy-MM-dd}" sortexpression="lasttime" />
         <asp:BoundField HeaderText="开卡时间" DataField="openTime" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}" sortexpression="openTime" />
        <asp:BoundField HeaderText="状 态" DataField="statesName" sortexpression="states" />
        <asp:BoundField HeaderText="经销商" DataField="companyName" sortexpression="companyName" />
        <asp:BoundField HeaderText="" DataField="cardid" Visible="false" sortexpression="cardid" />
         <asp:BoundField HeaderText="短信状态" DataField="isSend" Visible="false" sortexpression="isSend" />
        <asp:TemplateField ShowHeader="False" HeaderText="操作">
        <ItemStyle Width="150px" />
             <ItemTemplate>
               <asp:LinkButton ID="lbtnOpen" CommandName="open" OnClientClick="return confirm('确定要激活吗?');" CommandArgument='<%# Container.DataItemIndex %>' runat="server" Text="激活"></asp:LinkButton>
               &nbsp;
                 <asp:LinkButton ID="lbtnCancel" CommandName="cance" OnClientClick="return confirm('确定要取消激活吗?');" CommandArgument='<%# Container.DataItemIndex %>' runat="server" Text="取消激活"></asp:LinkButton>
               &nbsp;
               <asp:LinkButton ID="lbtnDisable" CommandName="disable" OnClientClick="return confirm('确定使该卡失效吗?');" CommandArgument='<%# Container.DataItemIndex %>' runat="server" Text="失效"></asp:LinkButton>
                 &nbsp;
               <a style='cursor:hand; display:none;'  onclick="javascript:window.open('SendGSM.aspx?cardid=<%# Eval("cardid") %>','window','Width=400px,Height=400px')">
    短信
               </a>
             </ItemTemplate>
        </asp:TemplateField>
        </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="True" Font-Size=30px />
             <HeaderStyle BackColor="#E2E7EB" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
             <AlternatingRowStyle BackColor="White" />
             <PagerSettings Visible="False" />
        </asp:GridView>
     <table width="90%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td bgcolor="#E9ECEF">

                 <asp:ImageButton ID="ibtnOpenCard"  OnClientClick="return confirm('确定要激活选中的礼品卡吗？');" ImageUrl="../images/btnOpenCard.gif" runat="server" OnClick="ibtnOpenCard_Click" />

       </td>
               
         <td height="25" align="right" bgcolor="#E9ECEF"><asp:Label ID="LblRecordCount" runat="server"></asp:Label>
            <asp:Label ID="LblCurrentIndex" runat="server"></asp:Label>
            <asp:Label ID="LblPageCount" runat="server"></asp:Label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:LinkButton ID="btnFirst" CommandArgument="first" OnClick="PagerButtonClick" runat="server">首 页</asp:LinkButton> 
            <asp:LinkButton ID="btnPrev" CommandArgument="prev" OnClick="PagerButtonClick" runat="server">上一页</asp:LinkButton> 
            <asp:LinkButton ID="btnNext" CommandArgument="next" OnClick="PagerButtonClick" runat="server">下一页</asp:LinkButton> 
            <asp:LinkButton ID="btnLast" CommandArgument="last" OnClick="PagerButtonClick" runat="server">尾 页</asp:LinkButton> 
             跳转到第<asp:DropDownList ID="ddlCurrentPage" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> </asp:DropDownList>页&nbsp;
         </td>
       </tr>
  
          <tr>
       <td id="tdUpdateCompany" runat="server" colspan="2" bgcolor="#E9ECEF">
             &nbsp;经销商
              <asp:DropDownList ID="ddlCompany" runat="server">
              </asp:DropDownList>
                   <asp:ImageButton ID="ibtnUpdateCompany"  OnClientClick="return confirm('确定要更新经销商吗？');" ImageUrl="../images/btnUpdateCompany.gif" runat="server" OnClick="ibtnUpdateCompany_Click" />
           </td>
    
                
       </tr>
  
          <tr>
      <td height="40" align="left" id="tdExport" runat="server" bgcolor="#E9ECEF">
          <asp:FileUpload ID="FileUpload1" runat="server" Width="260px" />

            <asp:ImageButton ID="ibtnInport"   ImageUrl="../images/btnInport.gif" runat="server" OnClick="ibtnInport_Click" />
       </td>
    
                
         <td height="25" align="right" bgcolor="#E9ECEF" style="text-align:left">
     
      
          <asp:DropDownList ID="ddlStates0" runat="server">
          <asp:ListItem Text="未激活" Value="4"></asp:ListItem>
          <asp:ListItem Text="已开卡" Value="1"></asp:ListItem>
          <asp:ListItem Text="已使用" Value="2"></asp:ListItem>
          <asp:ListItem Text="已失效" Value="3"></asp:ListItem>
          
          </asp:DropDownList>
      


      <asp:ImageButton ID="ibtnOpenCard0"  OnClientClick="return confirm('确定要批量列新选中的礼品卡状态吗？');" ImageUrl="../images/btnUpdateStatesAll.gif" runat="server" OnClick="ibtnOpenCard0_Click" />
      
              </td>
       </tr>
    </table>
</td>
    </tr>
  </table>
    </div>
    </form>
</body>
</html>
